﻿    @foreach (var prop in ViewData.ModelMetadata.Properties.Where(pm => pm.ShowForEdit && !ViewData.TemplateInfo.Visited(pm))) { 
        if (prop.HideSurroundingHtml) { 
            @Html.Editor(prop.PropertyName) 
        } else {
            if (ViewData.TemplateInfo.TemplateDepth == 1) { 
            <div id="@((prop.DisplayName ?? prop.PropertyName).ToLower())" class="settingsGroup">
                @Html.Editor(prop.PropertyName)
            </div>
            }
            else {
            <div class="formRow clearfix">
                <div class="formLabel">
                    <h4 style="font-weight:bold;">@Html.Label(prop.PropertyName, prop.DisplayName ?? prop.PropertyName)</h4>
                    @if (prop.Description != null) {
                    <p>@prop.Description</p>
                    }
                </div>
                <div class="formElement">
                    @Html.Editor(prop.PropertyName) 
                    @Html.ValidationMessage(prop.PropertyName, "*") 
                </div>
            </div>
            }
        }
    } 
